<template>
  <div>
    <input type="text" v-model="sayContent" placeholder="Enter what you want to say"/>
    <button @click="submit">save</button>
  </div>
</template>

<script lang="ts">
  import {Component, Vue} from 'vue-property-decorator';

  @Component({})
  export default class HelloRedPulse extends Vue {
    private sayContent: string = '';

    private submit() {
      if (this.sayContent === '') {
        alert('Please enter the content');
        return false;
      }
      this.$store.commit('addSay', this.sayContent);
      this.sayContent = '';
      this.$router.push({path: '/say'});
    }
  }
</script>
